package xia.wan.glowingterms.config;


import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;

/**
 * @PACKAGE_NAME: xia.wan.glowingterms.config
 * @AUTHOR: 太白
 * @DATE: 2022/12/01/19:20
 **/
public class Test {
    public static void main(String[] args) {

        String s = HttpUtil.get("https://devapi.qweather.com/v7/weather/now?location=101190113&key=f5fe849feaf24a60b54e6d6cb7062a8e");
        JSONObject jsonObject = JSONUtil.parseObj(s);
        System.out.println("时间为："+jsonObject.get("updateTime"));
        System.out.println("详细天气请查看"+jsonObject.get("fxLink"));
        Object now = jsonObject.get("now");
        JSONObject nowJson = JSONUtil.parseObj(now);
        System.out.println("当前温度为"+nowJson.get("temp")+"℃");
        System.out.println("天气状况为"+nowJson.get("text"));
        System.out.println("风力等级"+nowJson.get("windScale")+"级");
        System.out.println("能见度"+nowJson.get("vis")+"公里");



    }
}
